package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController("UserCategoryController")
@Slf4j
@RequestMapping("/user/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

     @GetMapping("/list")
    public Result<List<Category>> list(String type) {
         log.info("查询为{}", type == "1" ? "菜品分类" : "套餐查询" );
         List<Category> categories = categoryService.classesSearch(type);
         return Result.success(categories);
     }


}
